import copy

class Solution(object):
    def __init__(self):
        self.candidates = None
        self.results = []

    def combine(self, candBegin, target, combination):
        if target==0:
            self.results.append(copy.copy(combination))
            return
        for i in range(candBegin, len(self.candidates)):
            if self.candidates[i]<=target:
                combination.append(self.candidates[i])
                self.combine(i+1, target-self.candidates[i], combination)
                combination.pop()

    def combinationSum2(self, candidates, target):
        """
        :type candidates: List[int]
        :type target: int
        :rtype: List[List[int]]
        """
        self.candidates = candidates
        self.combine(0, target, [])
        finalResult = []   
        for ret in self.results:
            ret.sort()
            if ret not in finalResult:
                finalResult.append(ret)
        return finalResult

print(Solution().combinationSum2([10, 1, 2, 7, 6, 1, 5], 8))